package com.yq.backend.controller;


import com.yq.backend.dto.SysLoginDto;
import com.yq.backend.pojo.Result;
import com.yq.backend.service.SysLoginService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


/**
 * @descriptions: 系统管理-登录
 * @author: yunqiang
 * @date: 2021/7/23 11:34
 */
@Api(tags = {"系统管理：登录控制类"})
@RestController
@RequestMapping("/api/V1/login")
public class SysLoginController {

    @Autowired
    private SysLoginService sysLoginService;


    @ApiOperation(value = "用户登录")
    @PostMapping("/doLogin")
    public Result doUserLogin(@RequestBody SysLoginDto sysLoginDto) throws Exception {
        return sysLoginService.doLogin(sysLoginDto);
    }

    @ApiOperation(value = "用户退出")
    @GetMapping(value = "/doLogout")
    public Result doLogout() throws Exception{
        return sysLoginService.doLogout();
    }

    @ApiOperation(value = "获取系统验证码")
    @GetMapping("/getCode")
    public Result getCode(){

        return sysLoginService.getCode();
    }
}
